package com.y2.authprj.mvc.controller.auth;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.w3c.dom.ls.LSInput;

import com.gdglc.spring.biz.auth.FunctionauthorityBiz;
import com.gdglc.spring.biz.auth.RoleauthorityBiz;
import com.gdglc.spring.biz.auth.SysroleBiz;
import com.y2.authprj.bean.auth.model.FunctionauthorityInfo;
import com.y2.authprj.bean.auth.model.RoleauthorityInfo;
import com.y2.authprj.bean.auth.model.SysroleInfo;
import com.y2.authprj.exception.BizException;

@Controller
@RequestMapping("/auth/roleauthority")
public class RoleauthorityController {
/*	@Resource(name="roleauthority")
	private RoleauthorityBiz biz;
	@Resource(name="SysroleBiz")
	private SysroleBiz sysbiz;
	@Resource(name="FunctionauthorityBiz")
	private FunctionauthorityBiz functionbiz;
	

	public FunctionauthorityBiz getFunctionbiz() {
		return functionbiz;
	}

	public void setFunctionbiz(FunctionauthorityBiz functionbiz) {
		this.functionbiz = functionbiz;
	}

	public SysroleBiz getSysbiz() {
		return sysbiz;
	}

	public void setSysbiz(SysroleBiz sysbiz) {
		this.sysbiz = sysbiz;
	}

	public RoleauthorityBiz getBiz() {
		return biz;
	}

	public void setBiz(RoleauthorityBiz biz) {
		this.biz = biz;
	}
	
	@RequestMapping("showadd")
	public String showadd(String[] delitems,Model model) {
		List<SysroleInfo> list=new ArrayList<>();
		for (int i = 0; i < delitems.length; i++) {
			try {
				SysroleInfo sysrole=sysbiz.findByid(Integer.parseInt(delitems[i]));
				list.add(sysrole);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		try {
			List<FunctionauthorityInfo> functionlist=functionbiz.findAll();
			model.addAttribute("functionlist", functionlist);
		} catch (BizException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		model.addAttribute("sysrolelist", list);

		return "auth/sysrole/jsp/roleauth";
	}*/
/*	@RequestMapping("add")
	public String add(RoleauthorityInfo rolea,Model model) {
			for (int i = 0; i < rolea.getRid().length; i++) {
				rolea.setRoleId(rolea.getRid()[i]);
				for (int j = 0; j < rolea.getFunctionid().length; j++) {
					rolea.setFunctionauthorityId(rolea.getFunctionid()[j]);
					try {
						biz.add(rolea);
					} catch (BizException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					
				}
				
			}
				
		return "redirect:/auth/sysrole/list";
	}*/
}
